From 72d0b4d2c291b8514f04c5fe2838d9c5c1ee4fd8 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 31 Jul 2015 13:44:56 -0400 Subject: [PATCH] text view: Use gtk_simulate_touchscreen Instead of repeated manual tests. --- gtk/gtktextview.c | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/gtk/gtktextview.c b/gtk/gtktextview.c index 55c1d0eb1f..a1cca95077 100644 --- a/gtk/gtktextview.c +++ b/gtk/gtktextview.c @@ -643,7 +643,6 @@ static gint text_window_get_height (GtkTextWindow *win); static guint signals[LAST_SIGNAL] = { 0 }; -static gboolean test_touchscreen = FALSE; G_DEFINE_TYPE_WITH_CODE (GtkTextView, gtk_text_view, GTK_TYPE_CONTAINER, G_ADD_PRIVATE (GtkTextView) @@ -1544,7 +1543,6 @@ G_GNUC_END_IGNORE_DEPRECATIONS GTK_TYPE_DIRECTION_TYPE, GTK_DIR_TAB_BACKWARD); gtk_widget_class_set_accessible_type (widget_class, GTK_TYPE_TEXT_VIEW_ACCESSIBLE); - test_touchscreen = g_getenv ("GTK_TEST_TOUCHSCREEN") != NULL; quark_text_selection_data = g_quark_from_static_string ("gtk-text-view-text-selection-data"); @@ -5170,8 +5168,7 @@ gtk_text_view_multipress_gesture_pressed (GtkGestureMultiPress *gesture, #endif device = gdk_event_get_source_device ((GdkEvent *) event); - is_touchscreen = test_touchscreen || - (gtk_get_debug_flags () & GTK_DEBUG_TOUCHSCREEN) != 0 || + is_touchscreen = gtk_simulate_touchscreen () || gdk_device_get_source (device) == GDK_SOURCE_TOUCHSCREEN; if (n_press == 1) @@ -7141,8 +7138,7 @@ gtk_text_view_drag_gesture_update (GtkGestureDrag *gesture, device = gdk_event_get_source_device (event); - is_touchscreen = test_touchscreen || - (gtk_get_debug_flags () & GTK_DEBUG_TOUCHSCREEN) != 0 || + is_touchscreen = gtk_simulate_touchscreen () || gdk_device_get_source (device) == GDK_SOURCE_TOUCHSCREEN; get_iter_from_gesture (text_view, text_view->priv->drag_gesture, @@ -7277,8 +7273,7 @@ gtk_text_view_drag_gesture_end (GtkGestureDrag *gesture, event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence); device = gdk_event_get_source_device (event); - is_touchscreen = test_touchscreen || - (gtk_get_debug_flags () & GTK_DEBUG_TOUCHSCREEN) != 0 || + is_touchscreen = gtk_simulate_touchscreen () || gdk_device_get_source (device) == GDK_SOURCE_TOUCHSCREEN; if (!is_touchscreen && clicked_in_selection && -- 2.30.2